import request from '@/utils/request'

export function getList(params) {
  return request({
    url: '/system/user/v1/list',
    method: 'get',
    params
  })
}
//删除账号
export function getDelete(id) {
    return request({
      url: `/system/user/v1/${id}`,
      method: 'DELETE'
    })
}
//新建子账号

export function addRole(params) {
  return request({
    url: '/system/user/v1',
    method: 'post',
    params
  })
}
//查询角色下拉框  
export function getRole() {
    return request({
      url: '/system/role/v1/roleDownSelect',
      method: 'get',
    })
  }
//查询角色下拉框（新）
export function getSelectRole() {
  return request({
    url: '/system/role/v1/select',
    method: 'get',
  })
}
//查询用户帐号
export function getUserDetail(id) {
  return request({
    url: `/system/user/v1/${id}`,
    method: 'get',
  })
}

//更新用户帐号
export function editUser(data) {
  return request({
    url: '/system/user/v1',
    method: 'put',
    data
  })
}
//重置密码
export function resetPassword(id) {
  return request({
    url: `/system/user/v1/reset/password/${id}`,
    method: 'put',
  })
}

//禁用账号
export function setStatus(params) {
    return request({
      url: '/system/user/v1/status',
      method: 'put',
      params
    })
}

//修改密码
export function setPassword(params) {
    return request({
      url: '/system/user/v1/password',
      method: 'put',
      params
    })
}



//获取 收款码编号
export function getLastPayCode() {
  return request({
    url: '/merchant/pay/code/getLastPayCode',
    method: 'get',
  })
}

// 生成收款码
export function addPayCode(params) {
  return request({
    url: '/merchant/pay/code',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    params
  })
}
// 创建店铺码
export function addShopCode(params) {
  return request({
    url: '/merchant/pay/code/shop/code',
    method: 'post',
    headers: {
      'Content-Type': 'application/x-www-form-urlencoded'
    },
    params
  })
}

//获取角色列表分页
export function getRoleList(params) {
  return request({
    url: '/system/role/v1/list',
    method: 'get',
    params
  })
}

//查询权限菜单
export function getMenus(params) {
  return request({
    url: '/system/role/v1/menus',
    method: 'get',
    params
  })
}

//新增角色
export function addRolePermissions(data) {
  return request({
    url: '/system/role/v1',
    method: 'post',
    data
  })
}

//查询角色拥有权限菜单
export function getRoleMenus(id) {
  return request({
    url: `/system/role/v1/menus/${id}`,
    method: 'get',
  })
}

//更新角色权限信息
export function editMenus(data) {
  return request({
    url: '/system/role/v1/menus',
    method: 'put',
    data
  })
}

//更新角色
export function editRoleName(params) {
  return request({
    url: '/system/role/v1',
    method: 'put',
    params
  })
}

//删除角色
export function deleteRole(id) {
  return request({
    url: `/system/role/v1/${id}`,
    method: 'DELETE'
  })
}

//2022-6-24

//查询区域列表
export function getAreaList(params) {
  return request({
    url: '/gov/area/v1/list',
    method: 'get',
    params
  })
}
//查询区域下拉框
export function getAreaSelect(params) {
  return request({
    url: '/gov/area/v1/select',
    method: 'get',
    params
  })
}
//新增区域
export function addArea(data) {
  return request({
    url: '/gov/area/v1',
    method: 'post',
    data
  })
}
//查询区域详情
export function getAreaDetail(id) {
  return request({
    url: `/gov/area/v1/detail/${id}`,
    method: 'get',
  })
}
//编辑区域
export function editArea(data) {
  return request({
    url: '/gov/area/v1/',
    method: 'put',
    data
  })
}

//2022-11-7
//查询角色区域列表
export function getUserAreaList(id) {
  return request({
    url: `/system/role/v1/area/list/${id}`,
    method: 'get',
  })
}
//更新角色区域信息
export function editUserArea(data) {
  return request({
    url: '/system/role/v1/area',
    method: 'put',
    data
  })
}
